# coding: utf-8

from elasticsearch import Elasticsearch

es = Elasticsearch(hosts="172.16.202.33")

BODY = {
    "actions": [
        {
            "add": {
                "index": "wangsir"
            }
        }
    ]
}
es.indices.put_alias(index='wangsir', name='wangsir-ali1', body=BODY)
es.indices.delete_alias(index='wangsir', name='wangsir-ali1')

print(es.indices.get_alias(index='wangsir'))